package com.lzw.service.impl.superAdmin;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.lzw.mapper.superAdmin.MedicinesManageMapper;
import com.lzw.pojo.Medicines;
import com.lzw.service.superAdmin.MedicinesManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MedicinesManageServiceImpl implements MedicinesManageService {

    @Autowired
    private MedicinesManageMapper medicinesManageMapper;

    @Override
    public List<Medicines> list(Integer pageNum, Integer pageSize, String name, String batchNumber, String manufacturer, String supplier) {
        PageHelper.startPage(pageNum,pageSize);
        List<Medicines> list = medicinesManageMapper.list(name, batchNumber, manufacturer, supplier);
        Page<Medicines> medicines = (Page<Medicines>) list;
        return medicines;
    }

    @Override
    public void delete(List<Integer> ids) {
        medicinesManageMapper.delete(ids);
    }

    @Override
    public void add(Medicines medicines) {
        medicinesManageMapper.add(medicines);
    }

    @Override
    public void update(Medicines medicines) {
        medicinesManageMapper.update(medicines);
    }

    @Override
    public Medicines getById(Integer medicineId) {
        return medicinesManageMapper.getById(medicineId);
    }
}
